<?php
/**
 * Created by PhpStorm.
 * User: wuz
 * Date: 2016/8/23
 * Time: 11:28
 */
include 'RegexClass/RegexClass.php';
$test=new  Ycf\Lession\Regex\RegexClass\RegexClass();
$array= array("Linux Redhat9.0","Apache2.2.9","MySQL5.0.51","PHP5.2.6","LAMP","100");
$regexArrary="/^[A-Za-z]+(\d|\.)+$/";
echo "第二题："."<br>";
var_dump($test->regexArray($regexArrary,$array));
echo "<br>";

$url="http://www.yaochufa.com/index.php";
$regexUrl="/(http?):\/\/(www).([^\.]*).(com|cn)(\/\w*\.([a-zA-z]*))/";
$matchUrl=$test->regexUrl($regexUrl,$url);
echo "第三题："."<br>";
echo "匹配的网址：".$matchUrl[0]."<br>";
echo "协议:".$matchUrl[1]."<br>";
echo "主机:".$matchUrl[2]."<br>";
echo "域名:".$matchUrl[3]."<br>";
echo "顶级域名:".$matchUrl[4]."<br>";
echo "文件名:".$matchUrl[5]."<br>";

$allUrl='<tr><td><a href=\"http://qzone.qq.com\">QQ空间</a></td><td>
      <a href=\"http://www.ganji.com\">赶 集 网</a></td><td>
      <a href=\"http://www.baixing.com\">百 姓 网</a></td><td>
      <a href=\"http://www.taobao.com\">淘 宝 网</a></td><td>
      <a href=\"http://tuan.baidu.com\">百度团购</a></td><td>
      <a href=\"http://www.dianping.com\">大众点评网</a></td></tr>';
$regexALLUrl="/(http?):\/\/([^\.]*).([^\.]*).(com|cn)/";
$matchAllUrl=$test->regexAllUrl($regexALLUrl,$allUrl);
echo "第四题："."<br>";
foreach ($matchAllUrl as $row){
    echo "匹配到的网址为：".$row[0]."<br>";
}
echo "第五题："."<br>";
$replaceString = "这个///文本中有<b>村提和</b>和<u>带有下化线</u>以及<i>斜体</i>还有<font color='red' size='7'>带有颜/色标记///和字体大小标记";
$regexReplace = "/<\/?[^>]+>/i";
$replace=$test->regexReplace($regexReplace,$replaceString);
echo $replace;